<div class="dialog-wrap">
    <!---筛选 start--->
    <form class="layui-form">
        <div class="layui-form-item">
            <label class="layui-form-label required">类型 <span class="color-red">*</span></label>
            <div class="layui-input-inline">
                <select name="remarkType" lay-filter="remarkType">
                    <option value="1" data-type="1">候选人电话</option>
                    <option value="2" data-type="2">顾问面试</option>
                    <option value="3" data-type="3">顾问面试 详细</option>
                    <option value="4" data-type="4">客户电话</option>
                    <option value="5" data-type="5">客户拜访</option>
                    <option value="6" data-type="6">其他</option>
                </select>
            </div>
        </div>
    </form>
    <!---筛选 start--->

    <!---layui-hide为隐藏，去除显示--->
    <!---候选人电话 start--->
    <form class="layui-form remark-form" data-type="1">
        <div class="layui-form-item">
            <label class="layui-form-label">备注<span class="color-red">*</span></label>
            <div class="layui-input-block">
                <textarea name="remark" lay-verify="required" placeholder="" class="layui-textarea"></textarea>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">状态</label>
            <div class="layui-input-inline">
                <select name="talentStatus">
                    <option value=""></option>
                    <option value="0">初试</option>
                    <option value="1">复试</option>
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">提醒对象</label>
            <div class="layui-input-inline">
                <input type="text" name="reminder" placeholder="" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn layui-btn-normal layui-hide" id="saveBtn" lay-submit lay-filter="saveBtn">确认保存</button>
            </div>
        </div>
    </form>
    <!---候选人电话 end--->

    <!---顾问面试 start--->
    <form class="layui-form remark-form layui-hide" data-type="2">
        <div class="layui-form-item">
            <label class="layui-form-label">备注</label>
            <div class="layui-input-block">
                <div class="mb-10">
                    <div class="pt-5 pb-5">候选人基本情况<span class="color-red">*</span></div>
                    <textarea name="remark1" lay-verify="required" placeholder="" class="layui-textarea"></textarea>
                </div>
                <div class="mb-10">
                    <div class="pt-5 pb-5">求职方向及离职原因<span class="color-red">*</span></div>
                    <textarea name="remark2" lay-verify="required" placeholder="" class="layui-textarea"></textarea>
                </div>
                <div class="mb-10">
                    <div class="pt-5 pb-5">薪资架构<span class="color-red">*</span></div>
                    <textarea name="remark3" lay-verify="required" placeholder="" class="layui-textarea"></textarea>
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">状态</label>
            <div class="layui-input-inline">
                <select name="talentStatus">
                    <option value=""></option>
                    <option value="0">初试</option>
                    <option value="1">复试</option>
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">提醒对象</label>
            <div class="layui-input-inline">
                <input type="text" name="reminder" placeholder="" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn layui-btn-normal layui-hide" lay-submit lay-filter="saveBtn">确认保存</button>
            </div>
        </div>
    </form>
    <!---顾问面试 end--->

    <!---顾问面试 详细 start--->
    <form class="layui-form remark-form layui-hide" data-type="3">
        <div class="layui-form-item">
            <label class="layui-form-label">备注</label>
            <div class="layui-input-block">
                <div class="mb-10">
                    <div class="pt-5 pb-5">1. 动机--考虑外部机会或离职的原因<span class="color-red">*</span></div>
                    <textarea name="remark1" lay-verify="required" placeholder="" class="layui-textarea"></textarea>
                </div>
                <div class="mb-10">
                    <div class="pt-5 pb-5">2. 期望--对行业/上司/职位/薪资等期望<span class="color-red">*</span></div>
                    <textarea name="remark2" lay-verify="required" placeholder="" class="layui-textarea"></textarea>
                </div>
                <div class="mb-10">
                    <div class="pt-5 pb-5">3. 是否胜任--哪些工作能力/经历/成绩符合客户的要求<span class="color-red">*</span></div>
                    <textarea name="remark3" lay-verify="required" placeholder="" class="layui-textarea"></textarea>
                </div>
                <div class="mb-10">
                    <div class="pt-5 pb-5">4. 是否合适--哪些性格特征是否符合直接上司或团队的期望<span class="color-red">*</span></div>
                    <textarea name="remark4" lay-verify="required" placeholder="" class="layui-textarea"></textarea>
                </div>
                <div class="mb-10">
                    <div class="pt-5 pb-5">5. 组织架构--汇报对象/下属/同级别<span class="color-red">*</span></div>
                    <textarea name="remark5" lay-verify="required" placeholder="" class="layui-textarea"></textarea>
                </div>
                <div class="mb-10">
                    <div class="pt-5 pb-5">6. 薪资架构--现金和福利的具体组成<span class="color-red">*</span></div>
                    <textarea name="remark6" lay-verify="required" placeholder="" class="layui-textarea"></textarea>
                </div>
                <div class="mb-10">
                    <div class="pt-5 pb-5">7. 外部机会--是否有其他机会在同时进行/如有，是什么公司，并进展到什么阶段<span class="color-red">*</span></div>
                    <textarea name="remark7" lay-verify="required" placeholder="" class="layui-textarea"></textarea>
                </div>
                <div class="mb-10">
                    <div class="pt-5 pb-5">8. 兴趣程度--对推荐职位兴趣的强烈程度/如有其他机会，如何排序</div>
                    <textarea name="remark8" lay-verify="required" placeholder="" class="layui-textarea"></textarea>
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">状态</label>
            <div class="layui-input-inline">
                <select name="talentStatus">
                    <option value=""></option>
                    <option value="0">初试</option>
                    <option value="1">复试</option>
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">提醒对象</label>
            <div class="layui-input-inline">
                <input type="text" name="reminder" placeholder="" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn layui-btn-normal layui-hide" lay-submit lay-filter="saveBtn">确认保存</button>
            </div>
        </div>
    </form>
    <!---顾问面试 详细 end--->

    <!---客户电话 start--->
    <form class="layui-form remark-form layui-hide" data-type="4">
        <div class="layui-form-item">
            <label class="layui-form-label">备注<span class="color-red">*</span></label>
            <div class="layui-input-block">
                <textarea name="remark" lay-verify="required" placeholder="" class="layui-textarea"></textarea>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">状态</label>
            <div class="layui-input-inline">
                <select name="talentStatus">
                    <option value=""></option>
                    <option value="0">初试</option>
                    <option value="1">复试</option>
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">提醒对象</label>
            <div class="layui-input-inline">
                <input type="text" name="reminder" placeholder="" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn layui-btn-normal layui-hide" lay-submit lay-filter="saveBtn">确认保存</button>
            </div>
        </div>
    </form>
    <!---客户电话 end--->

    <!---客户拜访 start--->
    <form class="layui-form remark-form layui-hide" data-type="5">
        <div class="layui-form-item">
            <label class="layui-form-label">备注<span class="color-red">*</span></label>
            <div class="layui-input-block">
                <textarea name="remark" lay-verify="required" placeholder="" class="layui-textarea"></textarea>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">状态</label>
            <div class="layui-input-inline">
                <select name="talentStatus">
                    <option value=""></option>
                    <option value="0">初试</option>
                    <option value="1">复试</option>
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">提醒对象</label>
            <div class="layui-input-inline">
                <input type="text" name="reminder" placeholder="" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn layui-btn-normal layui-hide" lay-submit lay-filter="saveBtn">确认保存</button>
            </div>
        </div>
    </form>
    <!---客户拜访 end--->

    <!---其他 start--->
    <form class="layui-form remark-form layui-hide" data-type="6">
        <div class="layui-form-item">
            <label class="layui-form-label">备注<span class="color-red">*</span></label>
            <div class="layui-input-block">
                <textarea name="remark" lay-verify="required" placeholder="" class="layui-textarea"></textarea>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">状态</label>
            <div class="layui-input-inline">
                <select name="talentStatus">
                    <option value=""></option>
                    <option value="0">初试</option>
                    <option value="1">复试</option>
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">提醒对象</label>
            <div class="layui-input-inline">
                <input type="text" name="reminder" placeholder="" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn layui-btn-normal layui-hide" lay-submit lay-filter="saveBtn">确认保存</button>
            </div>
        </div>
    </form>
    <!---其他 end--->

</div>
<script>
    layui.use(['layer', 'form', 'miniPage', 'element', 'utils'], function () {
        var $ = layui.jquery,
            layer = layui.layer,
            form = layui.form,
            miniPage = layui.miniPage,
            element = layui.element,
            utils = layui.utils;
        /**
         * 初始化表单，要加上，不然刷新部分组件可能会不加载
         */
        form.render();

        // 当前弹出层，防止ID被覆盖
        var parentIndex = layer.index;

        //监听提交
        form.on('submit(saveBtn)', function (data) {
            data.field.type = $('[lay-filter="remarkType"]').val();
            utils.Ajax({
                url: 'api/talent.json',
                dataType: 'json',
                type: 'post',
                data: data.field,
                success: function (response) {
                    layer.msg(response.message, {time: 1000}, function () {
                        layer.close(parentIndex);
                    })
                }
            });

            return false;
        });

        //选择
        form.on('select(remarkType)', function (data) {
            var _type = $(data.elem).find("option:selected").data('type');
            $('.remark-form').each(function () {
                var $this = $(this);
                $this.addClass('layui-hide');
                $this[0].reset();
            });
            $('.remark-form[data-type="'+ _type +'"]').removeClass('layui-hide');
        });


    });

</script>
